// ==========================================================================
// GFast自动生成model操作代码。
// 生成日期：2024-11-11 21:00:33
// 生成路径: internal/app/system/model/balance_records.go
// 生成人：王中阳
// desc:余额记录
// company:云南奇讯科技有限公司
// ==========================================================================

package model

import (
	"github.com/gogf/gf/v2/os/gtime"
	"github.com/gogf/gf/v2/util/gmeta"
	comModel "github.com/tiger1103/gfast/v3/internal/app/common/model"
)

// BalanceRecordsInfoRes is the golang structure for table balance_records.
type BalanceRecordsInfoRes struct {
	gmeta.Meta   `orm:"table:balance_records"`
	Id           int                        `orm:"id,primary" json:"id" dc:"ID"` // ID
	Userid       int                        `orm:"userid" json:"userid" dc:"用户"` // 用户
	LinkedUserid *LinkedBalanceRecordsUsers `orm:"with:id=userid" json:"linkedUserid"`
	Money        float64                    `orm:"money" json:"money" dc:"金额"`          // 金额
	Balance      float64                    `orm:"balance" json:"balance" dc:"当前余额"`    // 当前余额
	CreatedAt    *gtime.Time                `orm:"created_at" json:"createdAt" dc:"时间"` // 时间
	UpdatedAt    *gtime.Time                `orm:"updated_at" json:"updatedAt" dc:""`   //
}
type LinkedBalanceRecordsUsers struct {
	gmeta.Meta `orm:"table:users"`
	Id         int    `orm:"id" json:"id" dc:""`                //
	Username   string `orm:"username" json:"username" dc:"用户名"` // 用户名
}

type BalanceRecordsListRes struct {
	Id           int                        `json:"id" dc:"ID"`
	Userid       int                        `json:"userid" dc:"用户"`
	LinkedUserid *LinkedBalanceRecordsUsers `orm:"with:id=userid" json:"linkedUserid" dc:"用户"`
	Money        float64                    `json:"money" dc:"金额"`
	Balance      float64                    `json:"balance" dc:"当前余额"`
	CreatedAt    *gtime.Time                `json:"createdAt" dc:"时间"`
}

// BalanceRecordsSearchReq 分页请求参数
type BalanceRecordsSearchReq struct {
	comModel.PageReq
	Id        string `p:"id" dc:"ID"`                                                         //ID
	Userid    string `p:"userid" v:"userid@integer#用户需为整数" dc:"用户"`                           //用户
	Money     string `p:"money" v:"money@float#金额需为浮点数" dc:"金额"`                              //金额
	Balance   string `p:"balance" v:"balance@float#当前余额需为浮点数" dc:"当前余额"`                      //当前余额
	CreatedAt string `p:"createdAt" v:"createdAt@datetime#时间需为YYYY-MM-DD hh:mm:ss格式" dc:"时间"` //时间
}

// BalanceRecordsSearchRes 列表返回结果
type BalanceRecordsSearchRes struct {
	comModel.ListRes
	List []*BalanceRecordsListRes `json:"list"`
}

// 相关连表查询数据
type LinkedBalanceRecordsDataSearchRes struct {
	LinkedBalanceRecordsUsers []*LinkedBalanceRecordsUsers `json:"linkedBalanceRecordsUsers"`
}

// BalanceRecordsAddReq 添加操作请求参数
type BalanceRecordsAddReq struct {
	Userid  int     `p:"userid"  dc:"用户"`
	Money   float64 `p:"money" v:"required#金额不能为空" dc:"金额"`
	Balance float64 `p:"balance"  dc:"当前余额"`
}

// BalanceRecordsEditReq 修改操作请求参数
type BalanceRecordsEditReq struct {
	Id      int     `p:"id" v:"required#主键ID不能为空" dc:"ID"`
	Userid  int     `p:"userid"  dc:"用户"`
	Money   float64 `p:"money" v:"required#金额不能为空" dc:"金额"`
	Balance float64 `p:"balance"  dc:"当前余额"`
}
